/**
 * 
 */
package com.mingyizhudao.app.view.doctor.adpter;

import java.util.List;

import com.dixiang.framework.network.Net;
import com.dixiang.framework.utils.Utils;
import com.mingyizhudao.app.R;
import com.mingyizhudao.app.common.BaseViewHolder;
import com.mingyizhudao.app.entity.CityEntity;
import com.mingyizhudao.app.view.doctor.bean.DoctorsEntity;
import com.mingyizhudao.app.view.mine.bean.CommentEntity;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RatingBar;
import android.widget.TextView;

/**
 * @author Administrator
 *
 */
public class DoctorCommentAdapter extends BaseAdapter{
	private Context mContext;
	private List<CommentEntity> cityList;
	private LayoutInflater inflater;
	private String type;
	public DoctorCommentAdapter(Context context,List<CommentEntity> cityList) {
		this.mContext = context;
		this.cityList = cityList;
		this.inflater = LayoutInflater.from(mContext);
	}

	
	
	public DoctorCommentAdapter(Context context,List<CommentEntity> cityList,String type) {
		this.type = type;
		this.mContext = context;
		this.cityList = cityList;
		this.inflater = LayoutInflater.from(mContext);
	}
	@Override
	public int getCount() {
		return cityList== null?0:cityList.size();
	}

	@Override
	public Object getItem(int arg0) {
		return cityList.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		if(convertView == null){
			convertView = inflater.inflate(R.layout.lv_item_comment, parent, false);
			holder = new ViewHolder();
			holder.tv_uname = (TextView) convertView.findViewById(R.id.tv_uname);
			holder.tv_comment = (TextView) convertView.findViewById(R.id.tv_comment);
			holder.rb_small = (RatingBar) convertView.findViewById(R.id.rb_small);
			
			
			convertView.setTag(holder);
		}else{
			holder = (ViewHolder)convertView.getTag();
		}
		
		holder.tv_uname.setText(cityList.get(position).getUser_name());
		
		holder.tv_comment.setText(cityList.get(position).getComment_text());
		
		holder.rb_small.setRating(5);
		
		
		return convertView;
	}

	public final class ViewHolder{

		public TextView	tv_uname ,tv_comment;
		
		public RatingBar rb_small;
		
		
	}
}
